{include file="public/header" /}
<style type="text/css">
/* TAB */
.nav-tabs.nav>li>a {
    padding: 10px 25px;
    margin-right: 0;
}
.nav-tabs.nav>li>a:hover,
.nav-tabs.nav>li.active>a {
    border-top: 3px solid #1ab394;
    padding-top: 8px;
}
.nav-tabs>li>a {
    color: #A7B1C2;
    font-weight: 500;  
    margin-right: 2px;
    line-height: 1.42857143;
    border: 1px solid transparent;
    border-radius: 0;
}
</style>

<body class="gray-bg">
<div class="wrapper wrapper-content animated">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>专用支付配置</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">           
                    <div class="panel-body">                      
                        <div class="builder-tabs builder-form-tabs">
                            <ul class="nav nav-tabs">
                                {volist name="tabs" id="group" offset="0" length='100'}
                                    <li {eq name="id" value="$key"}class="active"{/eq}><a href="{:url('?id='.$key)}">{$group}配置</a></li>
                                {/volist}           
                            </ul>
                        </div>
                        <div class="form-group"></div>
                    
	                    <div class="builder-container">
	                        <div class="row">
	                            <div class="col-xs-12">
	                                <form class="form-horizontal" name="add" id="add" method="post" action="{:url('save?id='.$id)}">
	                                    <div class="hr-line-dashed"></div>                                
	                                    <div class="form-group">
			                            <label class="col-sm-3 control-label">网关域名：</label>
			                            <div class="input-group col-sm-4">
			                                 <input id="curl" type="text" class="form-control" name="curl" placeholder="网关域名" value="{if !empty($content['curl'])}{$content['curl']}{/if}">
			                            </div>
			                            </div>
			                            <div class="form-group">
			                            <label class="col-sm-3 control-label">公众号(AppId)：</label>
			                            <div class="input-group col-sm-4">
			                                 <input id="wxappid" type="text" class="form-control" name="wxappid" placeholder="输入公众号(AppId)" value="{if !empty($content['wxappid'])}{$content['wxappid']}{/if}">
			                            </div>
			                            </div>
			                            
			                            <div class="form-group">
			                            <label class="col-sm-3 control-label">开发者密码(AppSecret)：</label>
			                            <div class="input-group col-sm-4">
			                                 <input id="AppSecret" type="text" class="form-control" name="AppSecret" placeholder="输入开发者密码(AppSecret)" value="{if !empty($content['AppSecret'])}{$content['AppSecret']}{/if}">
			                            </div>
			                            </div>
			                            
			                            
			                            <div class="form-group">
			                            <label class="col-sm-3 control-label">支付商户号(Mch_Id)：</label>
			                            <div class="input-group col-sm-4">
			                                 <input id="wxmchid" type="text" class="form-control" name="wxmchid" placeholder="输入支付商户号(Mch_Id)" value="{if !empty($content['wxmchid'])}{$content['wxmchid']}{/if}">
			                            </div>
			                            </div>
			                            
			                            <div class="form-group">
			                            <label class="col-sm-3 control-label">支付密钥(APIKEY)：</label>
			                            <div class="input-group col-sm-4">
			                                 <input id="wxapikey" type="text" class="form-control" name="wxapikey" placeholder="输入支付密钥(APIKEY)" value="{if !empty($content['wxapikey'])}{$content['wxapikey']}{/if}">
			                            </div>
			                            </div>
			
			                            <div class="form-group">
			                            <label class="col-sm-3 control-label">支付类型：</label>
			                            <div class="input-group col-sm-4">
			                                 <input id="Paytype" type="text" class="form-control" name="Paytype" placeholder="支付类型" value="{if !empty($content['Paytype'])}{$content['Paytype']}{/if}">
			                            </div>
			                            </div>
	                                    <div class="hr-line-dashed"></div>
	                                    <div class="form-group">
	                                        <div class="col-sm-4 col-sm-offset-3">
	                                           <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
	                                            <!--<a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>-->
	                                            <!-- <button class=" jingyong" type = "1"><i class="fa fa-save"></i> 公共通道禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                            <!--  <button class=" jingyong"  type = "2"><i class="fa fa-save"></i> 通道一禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                            <!--   <button class=" jingyong"  type = "3"><i class="fa fa-save"></i> 通道二禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                            <!--    <button class=" jingyong" type = "4"><i class="fa fa-save"></i> 通道三禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                               
	                                        </div>
	                                    </div>                               
	                                </form>
	                                    <!--<div class="form-group">-->
	                                    <!--    <div class="col-sm-4 col-sm-offset-3">-->
	                                          
	                                            <!--<a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>-->
	                                    <!--         <button class=" btn btn-primary jingyong" type = "1"><i class="fa fa-save"></i> 公共通道禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                              <!--<button class="btn btn-primary jingyong"  type = "2"><i class="fa fa-save"></i> 通道一禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                              <!-- <button class="btn btn-primary jingyong"  type = "3"><i class="fa fa-save"></i> 通道二禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                              <!--  <button class="btn btn-primary jingyong" type = "4"><i class="fa fa-save"></i> 通道三禁用</button>&nbsp;&nbsp;&nbsp;-->
	                                               
	                                    <!--    </div>-->
	                                    <!--</div>-->
	                            </div>
	                        </div>
	                    </div>              
            		</div>
				</div>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}



<script type="text/javascript">
$(function(){
	$('#add').ajaxForm({
	beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
	success: complete, // 这是提交后的方法
	dataType: 'json'
});


	//全部删除
		$(".jingyong").click(function () {
		    var type = $(this).attr("type");
		    
			layer.confirm('确认禁用吗？', function (index) {
				$.ajax({
					type: 'post',
					dataType: 'json',
					url: "{:url('jingyong')}",
					data:{type:type},
					success: function (data) {
						if (data.code == "1") {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000,
							}, function () {
								location.reload();
							});
						} else {
							layer.msg(data.msg, {
								icon: 2,
								time: 2000,
							}, function () {
							});
						}
					},
					error: function (data) {
						layer.msg(data.msg, {
							icon: 2,
							time: 3000 //2秒关闭
						}, function () {
						});
					}
				})
			});
		});

function checkForm(){
// 	if( '' == $.trim($('#wxappid').val())){
// 		layer.msg('公众号(AppId)不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
// 		layer.close(index);
// 		});
// 		return false;
// 	}
// 	if( '' == $.trim($('#wxmchid').val())){
// 		layer.msg('支付商户号(Mch_Id)不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
// 		layer.close(index);
// 		});
// 		return false;
// 	}
// 	if( '' == $.trim($('#wxapikey').val())){
// 		layer.msg('支付密钥(APIKEY)不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
// 		layer.close(index);
// 		});
// 		return false;
// 	}
}

function complete(data){
	if(data.code == 1){
		layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
		layer.close(index);
		//window.location.href="{:url('index')}";
		});
	}else{
		layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1}, function(index){
		layer.close(index);
		});
		return false;
	}
}

});


    //IOS开关样式配置
   var elem = document.querySelector('.js-switch');
        var switchery = new Switchery(elem, {
            color: '#1AB394'
        });
    var config = {
        '.chosen-select': {},                    
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }



</script>
</body>
</html>
